package androidgame.teslawars.game.maps;

import java.util.ArrayList;

import androidgame.teslawars.game.FootSoldier;
import androidgame.teslawars.game.ForestTile;
import androidgame.teslawars.game.Level;
import androidgame.teslawars.game.MountainTile;
import androidgame.teslawars.game.PlainTile;
import androidgame.teslawars.game.Tank;
import androidgame.teslawars.game.Tile;
import androidgame.teslawars.game.Unit;



public class Map1 extends Level {

	public Map1(LevelListener listener) {
		super(listener);
		this.worldWidth = 15;
		this.worldHeight = 20;
		grid = new Tile[worldWidth][worldHeight];
		for (int i = 0; i < worldWidth; i++) {
			for (int j = 0; j< worldHeight; j++) {
				if ((i * j + 13) % 10 < 5) { 
					grid [i][j] = new ForestTile(i,j);
				} else {
					grid[i][j] = new PlainTile(i,j);
					if (Math.random() < .05)
						grid[i][j] = new MountainTile(i,j);
				}
			}
		}
				
		player1UnitList = new ArrayList<Unit>(9);
		player1UnitList.add(new FootSoldier(0,5, Player.PLAYER1));
		player1UnitList.add(new FootSoldier(2,4, Player.PLAYER1));
		player1UnitList.add(new FootSoldier(1,8, Player.PLAYER1));
		player1UnitList.add(new FootSoldier(2,6, Player.PLAYER1));
		player1UnitList.add(new Tank(0, 12, Player.PLAYER1));
		player1UnitList.add(new Tank(0, 13, Player.PLAYER1));
		player1UnitList.add(new FootSoldier(2, 15, Player.PLAYER1));
		player1UnitList.add(new FootSoldier(1, 18, Player.PLAYER1));
		player1UnitList.add(new FootSoldier(0, 19, Player.PLAYER1));
		player2UnitList = new ArrayList<Unit>(9);
		player2UnitList.add(new FootSoldier(worldWidth-1,5, Player.PLAYER2));  //coords are written thus to assure they mirror player 1's
		player2UnitList.add(new FootSoldier(worldWidth-3,4, Player.PLAYER2));
		player2UnitList.add(new FootSoldier(worldWidth-2,8, Player.PLAYER2));
		player2UnitList.add(new FootSoldier(worldWidth-3,6, Player.PLAYER2));
		player2UnitList.add(new Tank(worldWidth - 1, 12, Player.PLAYER2));
		player2UnitList.add(new Tank(worldWidth - 1, 13, Player.PLAYER2));
		player2UnitList.add(new FootSoldier(worldWidth - 3, 15, Player.PLAYER2));
		player2UnitList.add(new FootSoldier(worldWidth -2, 18, Player.PLAYER2));
		player2UnitList.add(new FootSoldier(worldWidth -1, 19, Player.PLAYER2));
		addUnitsToTiles();
		currentPlayerUnitList = player1UnitList;
		
		
	}
	
}

